package com.gsbelarus.gedemin.salary.entity.model;

import com.google.gson.annotations.Expose;

import java.io.Serializable;
import java.util.Date;

import io.realm.RealmList;
import io.realm.RealmObject;
import io.realm.annotations.Ignore;
import io.realm.annotations.Index;
import io.realm.annotations.PrimaryKey;

public class WorkScheduleModel extends RealmObject implements Serializable {  // Запланированный рабочий график на день. Отображается в графике работ для предстоящих дат.

    public enum DayType {DAY_OFF, WORK}

    @Ignore
    private DayType dayType;        // наличие поля требует RealmObject

    @Expose
    private int dayTypeIndex;

    @PrimaryKey
    @Index
    @Expose
    private String uid;

    @Ignore
    @Expose
    private String employeeKey;

    @Expose
    private EmployeeModel employee;

    @Expose
    private Date date;
    private RealmList<DayEventModel> events;

    public DayType getDayType() {
        return DayType.values()[getDayTypeIndex()];
    }

    public void setDayType(DayType dayType) {
        setDayTypeIndex(dayType.ordinal());
    }

    // generated getters & setters
    public String getEmployeeKey() {
        return employeeKey;
    }

    public void setEmployeeKey(String employeeKey) {
        this.employeeKey = employeeKey;
    }

    public int getDayTypeIndex() {
        return dayTypeIndex;
    }

    public void setDayTypeIndex(int dayTypeIndex) {
        this.dayTypeIndex = dayTypeIndex;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public EmployeeModel getEmployee() {
        return employee;
    }

    public void setEmployee(EmployeeModel employee) {
        this.employee = employee;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public RealmList<DayEventModel> getEvents() {
        return events;
    }

    public void setEvents(RealmList<DayEventModel> events) {
        this.events = events;
    }
}
